package com.woniu.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.woniu.entity.CreRefund;
import com.woniu.entity.ScoreCard;
import com.woniu.service.CreditScoreCardService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

/**
 * 评分卡
 * 陈泓霖
 * */
@RestController
@RequestMapping("/credit/scoreCard")
public class CreditScoreCardController extends BaseController {
    @Autowired
    private CreditScoreCardService creditScoreCardService;

    @GetMapping("/list")
    @ApiOperation("新增订单")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "scoreId", value = "评分id", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "scoreStandard", value = "评分字段", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "scoreTinyint", value = "boolean", dataType = "Boolean", dataTypeClass = Boolean.class),
            @ApiImplicitParam(name = "scoreDouble", value = "double", dataType = "Double", dataTypeClass = Double.class),
            @ApiImplicitParam(name = "scoreValue", value = "分值", dataType = "Integer", dataTypeClass = Integer.class),

    })
    public TableDataInfo list(ScoreCard soreCard)
    {
        startPage();
        List<ScoreCard> list = creditScoreCardService.findScoreList();
        return getDataTable(list);
    }

    /**
     * 修改
     */
    @PutMapping("/update")
    @ApiOperation("修改订单")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "scoreId", value = "评分id", dataType = "Integer", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "scoreStandard", value = "评分字段", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "scoreTinyint", value = "boolean", dataType = "Boolean", dataTypeClass = Boolean.class),
            @ApiImplicitParam(name = "scoreDouble", value = "double", dataType = "Double", dataTypeClass = Double.class),
            @ApiImplicitParam(name = "scoreValue", value = "分值", dataType = "Integer", dataTypeClass = Integer.class),

    })
    public AjaxResult edit(@RequestBody ScoreCard scoreCard)
    {
        return toAjax(creditScoreCardService.updateCreScorecard(scoreCard));
    }

    /**
     * 模式1 严格
     */
    @GetMapping("/pattern1")
    public AjaxResult pattern1()
    {
        return toAjax(creditScoreCardService.pattern1());
    }

    /**
     * 模式2 宽松
     */
    @GetMapping("/pattern2")
    public AjaxResult pattern2()
    {
        return toAjax(creditScoreCardService.pattern2());
    }

}
